package scenetracer.core.shader;

import scenetracer.SceneState;
import scenetracer.core.Primitive;
import scenetracer.image.Color;

public class GlassShader extends Shader {
	private float absDistance;
	private Color absColor;
	private float eta;
	private Color color;
	
	
	public GlassShader(String name) {
		super(name);
		this.type = "glass";
	}

	public float getEta() {
		return eta;
	}

	public void setEta(float eta) {
		this.eta = eta;
	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public float getAbsorbtionDistance() {
		return absDistance;
	}

	public void setAbsorbtionDistance(float absorptionDistance) {
		this.absDistance = absorptionDistance;
	}

	public Color getAbsorbtionColor() {
		return absColor;
	}

	public void setAbsorbtionColor(Color absorptionColor) {
		this.absColor = absorptionColor;
	}

	@Override
	public void shade(SceneState state) {		
		state.getRefractionColor().mul(color);		
	}

	@Override
	public void setPrim(Primitive primitive) {
		
		
		primitive.setReflectionK(0.2f);
		primitive.setRefractionIndex(eta);
		
		primitive.setRefractionK(1f);
	}
	
	
}
